from fastapi import APIRouter, Depends
from app.db.crud.role_crud import get_role
from app.db.crud import get_db
from sqlalchemy.orm import Session
from typing import Optional, Union
from app.common.response_code import resp_200, resp_400
from app.common.security import check_jwt_token


# 实例化API路由，需注册到主路由上去
roleAdminAPI = APIRouter(dependencies=[Depends(check_jwt_token)])

# 角色查询API
@roleAdminAPI.get("/getrole", summary="获取角色信息接口")
async def getRole(db: Session = Depends(get_db)):
    return resp_200(get_role(db))
